//
//  NSCache+HACShield.m
//  HACShield
//
//  Created by Chengjie on 2019/5/25.
//

#import "NSCache+HACShield.h"
#import "NSObject+HACSwizzling.h"

@implementation NSCache (HACShield)

+ (void)load {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        hac_swizzleInstanceMethod(hac_getClass(@"NSC", @"ache"), @selector(setObject:forKey:), @selector(hac_setObject:forKey:));
        hac_swizzleInstanceMethod(hac_getClass(@"NSC", @"ache"), @selector(setObject:forKey:cost:), @selector(hac_setObject:forKey:cost:));
    });
}


- (void)hac_setObject:(id)obj forKey:(id)key {
    if (obj && key) {
        [self hac_setObject:obj forKey:key];
    }
}

- (void)hac_setObject:(id)obj forKey:(id)key cost:(NSUInteger)g {
    if (obj && key) {
        [self hac_setObject:obj forKey:key cost:g];
    }
}

@end
